package 网易机试;

import java.util.Scanner;

public class 第三题 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            long x = sc.nextLong();
            long f = sc.nextLong();
            long d = sc.nextLong();
            long p = sc.nextLong();
            System.out.println(func(x, f, d, p));
        }
        sc.close();
    }

    private static long func(long x, long f, long d, long p) {
        long count = 0;
        if (d < x)
            return 0;
        if (f >= d / x)
            return d / x;
        else {
            count += f;
            d -= f * x;
            count += d / (x + p);
        }
        return count;
    }
}
